package com.cyh.testdesignpattern.mediator;


import android.util.Log;

//闹钟， 具体的同事类
public class Alarm extends Colleague {

    public Alarm(Mediator mediator, String name) {
        super(mediator, name);

        mediator.register(name, this);
    }

    @Override
    public void sendMessage(int stateChange) {
        getMediator().getMessage(stateChange, getName());
    }

    public void sendAlarm(int stateCange) {
        Log.i("Alarm", "----Alarm---处理不了消息---加消息转发" );
        sendMessage(stateCange);
    }

    public void on() {
        Log.i("Alarm", "----Alarm---处理了消息 开" );
    }

    public void off() {
        Log.i("Alarm", "----Alarm---处理了消息 关" );
    }
}
